﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo03
{
    class Program
    {
        static void Main(string[] args)
        {
            //定义一个方法，实现一维数组的排序功能，从大到小排序。(不要用Array类的方法)
            int[] arr = { 1, 2, 3, 4, 5 };
            foreach (int item in arr)
            {
                Console.Write(item+" ");
            }
            for (int i = 0; i < arr.Length; i++)
            {
                for (int j = 0; j < arr.Length-i-1; j++)
                {
                    if (arr[j] < arr[j + 1])
                    {
                        int temp = arr[j];
                        arr[j] = arr[j + 1];
                        arr[j + 1] = temp;
                    }
                }

            }
            Console.WriteLine("");
            foreach (int item in arr)
            {

                Console.Write(item + " ");
            }
            
            Console.ReadKey();
        }
    }
}
